import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */

//旧键盘问题
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNextLine()) {
            String str1 = scanner.nextLine();
            String str2 = scanner.nextLine();
            func(str1,str2);
        }
    }

    /**
     *
     * @param str1 : 期待输入的
     * @param str2 : 实际输入的
     */
    public static void func (String str1, String str2) {
        Set<Character> set = new HashSet<>();   // f n g 4 n

        for (char ch : str2.toUpperCase().toCharArray()) {
            set.add(ch);
        }

        //str1: f a e n g e b h e 4 b r h b r r k b h a k b n r k b h r b h r k b h r

        //true: A E B H R K

        Set<Character> setBroken = new HashSet<>();
        for (char ch : str1.toUpperCase().toCharArray()) {
            if(!set.contains(ch) && !setBroken.contains(ch)) {
                setBroken.add(ch);
                System.out.print(ch);
            }
        }
    }
}